/* ---------- Majin Original UI palette ---------- */
:root {
  --bg:             #1a0d2c;   /* dark purple background */
  --bg-lighter:     #2a1545;   /* lighter purple for entities */
  --fg:             #c8c8d2;   /* light gray text for general content */
  --header-fg:      #00ff66;   /* bright vintage terminal green for headers */
  --link:           #ff9e3d;   /* warm orange for links */
  --border:         #ff6b35;   /* vibrant orange border */
  --input-bg:       #251438;   /* slightly lighter than bg for fields */
  --input-fg:       #d0d0e0;   /* light text for input fields */
  --btn-bg:         #ff6b35;   /* orange buttons to match borders */
  --btn-fg:         #1a0d2c;   /* dark text on orange buttons for contrast */
  --accent:         #9161c7;   /* purple accent for highlights */
  --admin-color:    #ff3377;   /* pink for admin indicators */
  --quote-color:    #7bff3b;   /* light green for quotes */
  --user-color:     #00ff66;   /* signature green for non-admin chat users */
  --font-main:      'Courier New', monospace;
  --font-headers:   'VT323', 'Courier New', monospace;
}

/* ---------- reset & base layout ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.4;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- chrome ---------- */
header {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  background-color: var(--bg);
  color: var(--header-fg);
  font-family: var(--font-headers);
  font-weight: bold;
  font-size: 1.25rem;
  box-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}

header a {
  color: var(--link);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease;
}

header a:hover {
  background-color: var(--border);
  color: var(--bg);
  border-radius: 3px;
}

.header-logo {
  width: 25px;
  height: 25px;
  vertical-align: middle;
  margin-right: 6px;
}

main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.footer-section {
  text-align: center;
}

/* ---------- typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--header-fg);
  font-family: var(--font-headers);
  margin-top: 0;
  text-shadow: 0 0 5px rgba(0, 255, 102, 0.5);
  letter-spacing: 1px;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

/* ---------- links ---------- */
a { 
  color: var(--link); 
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover { 
  opacity: 0.85; 
  text-decoration: underline;
}

/* ---------- forms ---------- */
input, button, textarea {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0;
  font-family: var(--font-main);
  background: var(--input-bg);
  color: var(--input-fg);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: all 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 5px rgba(145, 97, 199, 0.5);
}

button {
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}

button:hover { 
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(255, 107, 53, 0.4);
}

textarea { 
  resize: vertical; 
  min-height: 100px;
}

/* ---------- content ---------- */
.post-image {
  margin-top: 0.75rem;
}

.post-image a {
  display: inline-block;
}

.thumb {
  display: block;
  max-height: 150px;
  border: 2px solid var(--border);
  margin: 0.5rem 0;
  transition: all 0.2s ease;
}

.thumb:hover {
  transform: scale(1.05);
}

.post, .thread {
  margin: 1rem 0;
  padding: 1rem;
  background-color: var(--bg-lighter);
  border: 2px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.post:hover, .thread:hover {
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.post b {
  color: var(--header-fg);
  font-family: var(--font-headers);
}

blockquote {
  margin: 0.5rem 0 1rem;
  white-space: pre-wrap;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: #ffffff;  /* or #f0f0f0 for a slightly softer bright white */
  /* optional: add font-weight: 400; if it needs to be bolder against dark backgrounds */
}

.admin {
  color: var(--admin-color);
  font-weight: bold;
}

small {
  color: var(--fg);
  opacity: 0.8;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ---------- image upload indicator ---------- */
.file-upload-container {
  position: relative;
}

.file-upload-label {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--accent);
  color: var(--fg);
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  margin-bottom: 0.5rem;
}

.file-selected-indicator {
  color: var(--header-fg);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: none;
}

/* Show when file is selected */
input[type="file"]:valid + .file-selected-indicator {
  display: block;
}

/* ---------- tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}

th {
  background-color: var(--bg);
  color: var(--header-fg);
  font-family: var(--font-headers);
}

/* ---------- welcome page ---------- */
.welcome-container {
  max-width: 800px;
  margin: 0 auto;
}

.about-section, .philosophy-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--bg-lighter);
  border: 2px solid var(--border);
  border-radius: 3px;
}

.terminal-effect {
  position: relative;
  padding-left: 1rem;
}

.terminal-effect::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--header-fg);
}

.username-bubble {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 15px;
  margin-left: 0.5rem;
  color: var(--user-color);
  font-weight: bold;
  font-family: var(--font-headers);
  letter-spacing: 1px;
}

.username-bubble.admin {
  color: var(--admin-color);
}


/* ---------- form intro text ---------- */
.form-intro {
  margin-bottom: 1.5rem;
  color: var(--fg);
  font-style: italic;
  text-align: center;
  padding: 0.5rem;
  border-left: 3px solid var(--accent);
  background-color: var(--bg-lighter);
}


/* ---------- small-screen tweaks ---------- */
@media (max-width: 600px) {
  body { font-size: 15px; }
  input, button, textarea { font-size: 16px; } /* prevent iOS zoom */
  main { padding: 1rem; }
  .post, .thread { padding: 0.75rem; }
}

/* ---------- animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

main {
  animation: fadeIn 0.3s ease-in;
}

.post, .thread {
  animation: fadeIn 0.5s ease-in;
}



/* ---------- admin link styling ---------- */
.admin-link {
  display: inline-block;
  margin-left: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg);
  text-decoration: none;
  transition: all 0.2s ease;
}

.admin-link:hover {
  background-color: var(--border);
  color: var(--bg);
  text-decoration: none;
}



/* ---------- invite tree visualization ---------- */

.invite-tree-viewport {
  width: 100%;
  height: 80vh;
  overflow: auto;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 3px;
  position: relative;
  cursor: grab;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.invite-tree-viewport:active {
  cursor: grabbing;
}

.invite-tree-container {
  display: flex;
  gap: 4rem;
  padding: 3rem;
  min-width: max-content;
  transform-origin: top left;
  transition: transform 0.1s ease;
}

.invite-tree-root {
  display: inline-block;
}

/* Core tree structure */
.invite-tree,
.invite-tree ul {
  position: relative;
  padding-top: 20px;
  margin: 0;
  list-style: none;
  display: flex;
  justify-content: center;
}

.invite-tree::after,
.invite-tree ul::after {
  content: '';
  display: table;
  clear: both;
}

.invite-tree li {
  position: relative;
  padding: 20px 10px 0 10px;
  text-align: center;
  list-style-type: none;
  float: left;
}

/* Connector lines - uniform glow on all segments */
.invite-tree li::before,
.invite-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 20px;
  border-top: 2px solid var(--header-fg);
  filter: drop-shadow(0 0 4px rgba(0, 255, 102, 0.8));
  z-index: 1;
}

.invite-tree li::before {
  right: 50%;
  border-right: 2px solid var(--header-fg);
  border-radius: 0 5px 0 0;
}

.invite-tree li::after {
  left: 50%;
  border-left: 2px solid var(--header-fg);
  border-radius: 5px 0 0 0;
}

/* Remove connectors from single child */
.invite-tree li:only-child::after,
.invite-tree li:only-child::before {
  display: none;
}
.invite-tree li:only-child {
  padding-top: 0;
}

/* First child - no left connector */
.invite-tree li:first-child::before {
  border: 0 none;
  filter: none;
}

/* Last child - no right connector (prevents ghost lines) */
.invite-tree li:last-child::after {
  border: 0 none;
  filter: none;
}

/* Last child curve fix - ensures clean corner */
.invite-tree li:last-child::before {
  border-right: 2px solid var(--header-fg);
  border-radius: 0 5px 0 0;
}

/* Vertical line from parent to horizontal bar - uniform glow */
.invite-tree ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 20px;
  border-left: 2px solid var(--header-fg);
  filter: drop-shadow(0 0 4px rgba(0, 255, 102, 0.8));
  z-index: 1;
}

/* The node cards */
.invite-tree-node {
  display: inline-block;
  padding: 1rem;
  background: var(--bg-lighter);
  border: 2px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-main);
  font-size: 0.9rem;
  min-width: 140px;
  max-width: 200px;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 15px rgba(255, 107, 53, 0.3);
  transition: all 0.3s ease;
  margin: 0 auto;
}

.invite-tree-node:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(0, 255, 102, 0.4);
  border-color: var(--header-fg);
}

.invite-tree-node.invite-tree-admin {
  border-color: var(--admin-color);
  box-shadow: 0 0 15px rgba(255, 51, 119, 0.4);
}

.invite-tree-node.invite-tree-admin:hover {
  box-shadow: 0 5px 20px rgba(255, 51, 119, 0.6);
}

.invite-tree-username {
  color: var(--header-fg);
  font-family: var(--font-headers);
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
  text-shadow: 0 0 5px rgba(0, 255, 102, 0.3);
}

.invite-tree-admin-badge {
  display: inline-block;
  background: var(--admin-color);
  color: var(--bg);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  margin-bottom: 0.5rem;
  font-weight: bold;
  letter-spacing: 1px;
}

.invite-tree-date {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

/* Unused invite badges */
.invite-tree-unused {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--accent);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.invite-tree-unused-count {
  width: 100%;
  font-size: 0.7rem;
  color: var(--fg);
  opacity: 0.8;
  margin-bottom: 0.3rem;
  font-style: italic;
}

.invite-tree-code {
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--link);
  font-family: var(--font-main);
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  opacity: 0.9;
  cursor: help;
}

/* Info box */
.invite-tree-info {
  color: var(--fg);
  font-style: italic;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  border-left: 3px solid var(--header-fg);
  background: var(--bg-lighter);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .invite-tree-container {
    padding: 1rem;
    gap: 2rem;
  }
  
  .invite-tree-node {
    min-width: 100px;
    padding: 0.75rem;
    font-size: 0.8rem;
  }
  
  .invite-tree-username {
    font-size: 1rem;
  }
  
  .invite-tree li {
    padding: 20px 5px 0 5px;
  }
}

/* ---------- site-wide banner ---------- */
.site-banner {
  background: var(--link);
  color: var(--bg);
  text-align: center;
  padding: 0rem 1rem;
  font-weight: bold;
  font-family: var(--font-headers);
  font-size: 1.1rem;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.4);
  position: relative;
  z-index: 100;
  /* Remove white-space: pre-wrap unless you really need it (see #3) */
}

/* Kill default margins on any direct children (p, h1, etc.) */
.site-banner > * {
  margin: 0;
  padding: 0;
}

.site-banner:empty {
  display: none;
}


/* ---------- Admin banner form ---------- */
.banner-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: var(--bg-lighter);
  border: 2px solid var(--border);
  border-radius: 3px;
}

.banner-section h3 {
  margin-top: 0;
  color: var(--header-fg);
  margin-bottom: 1rem;
}

.banner-section form {
  max-width: 600px;
}

.banner-section input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.banner-section label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0.5rem 0;
}

/* Small textarea that grows with content */
.banner-section textarea {
  margin: 0.5rem 0;
  min-height: 40px;         /* Start small - about 2 lines */
  height: auto;
  resize: vertical;
  field-sizing: content;    /* Auto-grow on Chrome/Edge */
  max-height: 200px;
}