:root {
  --matrix-font: 'Courier New', monospace;
  --green: #0f0;
  --green-dim: #0a0;
  --card-bg: rgba(0, 0, 0, 0.78);
  --border: #0f0;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #000;
  color: var(--green);
  font-family: var(--matrix-font);
  font-size: 1rem;
  line-height: 1.4;
  overflow-x: hidden;
  overflow-y: auto;
}

canvas#matrix-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 40, 0, 0.92);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  color: var(--green);
  text-decoration: none;
}

.nav-desktop {
  display: none;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-left: auto;
  align-items: center;
}

.nav-desktop a {
  color: var(--green);
  text-decoration: none;
}

.nav-desktop a:hover {
  text-decoration: underline;
}

.nav-ext {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid #063;
}

.nav-toggle {
  display: inline-flex;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 4px;
  font-size: 1.25rem;
  cursor: pointer;
}

.nav-mobile {
  display: flex;
  flex-direction: column;
  background: rgba(0, 30, 0, 0.95);
  border-bottom: 1px solid var(--border);
}

.nav-mobile[hidden] {
  display: none;
}

.nav-mobile a {
  padding: 0.75rem 1rem;
  color: var(--green);
  text-decoration: none;
  min-height: 44px;
}

.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card.inner {
  margin-top: 1rem;
}

h1, h2 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 0.75rem;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: 1rem;
}

input, textarea, select {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  color: var(--green);
}

button, .btn {
  display: inline-block;
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

button:hover {
  background: #0c0;
}

.muted {
  color: #6c6;
}

.composer textarea {
  margin-bottom: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-form input[type="text"] {
  flex: 1;
  min-width: 120px;
}

.post-card .post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.delete-post-btn {
  background: #300;
  color: #f66;
  border: 1px solid #500;
  font-size: 0.7rem;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 2px;
  cursor: pointer;
  vertical-align: middle;
}
.delete-post-btn:hover {
  background: #500;
  color: #fff;
}

.post-text {
  word-break: break-word;
}
.post-text a {
  color: #fff;
  font-weight: bold;
  text-decoration: underline;
}
.post-text a.hashtag { color: #0ff; }
.post-text a.mention { color: #ff0; }

.post-images img,
.post-attachments img {
  max-width: 100%;
  height: auto;
  border: 1px solid #063;
}

.like-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.like-row button {
  min-height: 36px;
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: var(--green);
  border: 1px solid var(--border);
}

.like-row button.active {
  background: var(--green);
  color: #000;
}

.profile-shell {
  overflow: hidden;
}

.profile-header-img img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

.profile-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--green);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.dm-window, .irc-window {
  height: 280px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #063;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

.dm-msg {
  margin-bottom: 0.35rem;
}

.dm-msg.peer {
  color: #9f9;
}

.upload-result {
  background: #111;
  padding: 0.5rem;
  overflow: auto;
}

/* URL link previews + document previews in posts */
.link-preview {
  display: flex;
  gap: 0.75rem;
  margin: 0.5rem 0;
  padding: 0.5rem;
  border: 1px solid #063;
  border-radius: 4px;
  background: rgba(0, 20, 0, 0.4);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  align-items: flex-start;
}
.link-preview:hover {
  border-color: #0f0;
}
.lp-main {
  flex: 1;
  min-width: 0;
}
.lp-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}
.lp-favicon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.lp-site {
  font-family: monospace;
  word-break: break-all;
}
.lp-title {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.lp-desc {
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lp-thumb {
  width: 250px;
  flex-shrink: 0;
}
.lp-thumb .lp-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid #052;
}

.post-attachments {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.post-attachments figure {
  margin: 0;
  border: 1px solid #063;
  border-radius: 4px;
  padding: 0.35rem;
  background: rgba(0, 15, 0, 0.3);
}
.post-attachments .is-image img {
  width: 125px;
  height: 125px;
  object-fit: cover;
  display: block;
  border: 1px solid #063;
  cursor: pointer;
}

/* Doc / non-image file preview */
.doc-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
.doc-icon {
  display: inline-block;
  background: #052;
  color: #0f0;
  font-family: monospace;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-bottom: 0.25rem;
}
.doc-name {
  font-size: 0.85rem;
  word-break: break-all;
}
.doc-excerpt {
  margin: 0.35rem 0 0;
  padding: 0.3rem;
  background: #000;
  border: 1px solid #032;
  font-size: 0.7rem;
  line-height: 1.25;
  max-height: 4.5em;
  overflow: hidden;
  white-space: pre-wrap;
  color: #9f9;
}

/* Styles for the IRC page file/XDCC UI (tied social uploads) */
.uploader {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.uploader input[type="file"] {
  flex: 1;
  min-width: 120px;
}
.progress {
  position: relative;
  height: 10px;
  background: #111;
  border-radius: 4px;
  overflow: hidden;
  flex-basis: 100%;
  margin-top: 0.25rem;
}
.progress::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 100%;
  background: linear-gradient(90deg, #0f0 0%, #0f0 50%, #fff 100%);
  transform: skewX(-45deg);
  animation: progress 1s linear infinite;
}
@keyframes progress {
  0% { width: 0; }
  100% { width: 100%; }
}

@media (min-width: 640px) {
  .nav-toggle {
    display: none;
  }
  .nav-desktop {
    display: flex;
  }
  .nav-mobile {
    display: none !important;
  }
}