/* Clay's Cloud message board v2.1.0 — "squared terminal".
   Paperclips bones (monospace, thin square boxes, black terminal strip,
   beveled square buttons) + PictoChat DS chrome (straight 2px borders,
   square panels, square pen swatches, color-coded names). No curves. */

:root {
  --paper: #dcdcdc;
  --ink: #1a1a1a;
  --muted: #6f6f6f;
  --term: #0c0c0c;
  --term-ink: #e8e8e8;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --pen-red: #e5484d;
  --pen-orange: #f76b15;
  --pen-yellow: #ffd60a;
  --pen-green: #30a46c;
  --pen-blue: #3e8ef7;
  --pen-purple: #8e4ec6;
  --pen-pink: #d6409f;
}

* { box-sizing: border-box; }
body {
  font-family: var(--mono);
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
::selection { background: var(--pen-yellow); }

/* ---------- black terminal strip ---------- */
.topbar {
  background: var(--term);
  color: var(--term-ink);
  padding: 0;
  font-size: 0.9rem;
}
.topbar .term-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.2rem 0.35rem;
}
.topbar .brand {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--term-ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.topbar .brand img {
  width: 28px;
  height: 28px;
  border-radius: 0;
  object-fit: cover;
  border: 1px solid #444;
  image-rendering: pixelated;
}
.topbar .brand .prompt { color: var(--pen-green); font-weight: 700; }
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--term-ink); margin-left: 1.2rem; text-decoration: none; }
.topbar nav a:hover { color: var(--pen-yellow); text-decoration: underline; }
.topbar nav .badge { margin-left: 0.35rem; }
.topbar .who { margin-left: 1rem; margin-right: 0.2rem; color: #bdbdbd; }
.topbar .who .penname { font-weight: 700; }
.topbar nav form.inline { margin-left: 1rem; }
.topbar .term-status {
  padding: 0.3rem 1.2rem 0.7rem;
  color: #8a8a8a;
  font-size: 0.8rem;
}
.topbar .term-status .prompt { color: var(--pen-green); }
.topbar h1 { margin: 0; font-size: 1rem; }
.topbar h1 a { color: var(--term-ink); text-decoration: none; }

.cursor::after {
  content: "\258C";
  color: var(--pen-green);
  animation: blink 1.1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.badge {
  display: inline-block;
  background: var(--pen-red);
  color: #fff;
  border-radius: 0;
  padding: 0 0.45em;
  font-size: 0.8em;
  font-weight: 700;
}
form.inline { display: inline; }
button.linklike {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--term-ink);
  text-decoration: underline;
  font-size: 0.9rem;
  font-family: var(--mono);
}
.post-actions button.linklike { color: inherit; }

main { max-width: 660px; margin: 1.5rem auto; padding: 0 1rem 3rem; }
main.narrow { max-width: 430px; }

/* ---------- labeled boxes (Paperclips) ---------- */
.boxlabel {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}
.boxlabel .n { color: var(--pen-blue); }

/* ---------- square panels ---------- */
.composer, .authform {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 1.2rem 1.3rem;
  margin-bottom: 1.5rem;
}
h2 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
}
textarea, input[type=text], input[type=password] {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.95rem;
  font-family: var(--mono);
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}
textarea:focus, input[type=text]:focus, input[type=password]:focus {
  outline: 2px solid var(--pen-blue);
  outline-offset: 1px;
}
textarea { resize: vertical; }
.composer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.7rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.as { font-size: 0.85rem; color: var(--muted); }
.as .penname { font-weight: 700; }
.penname { color: var(--pen, var(--ink)); }

/* ---------- beveled square buttons (Paperclips) ---------- */
button[type=submit], .btn-bevel {
  font-family: var(--mono);
  background: #e8e8e8;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
}
button[type=submit]:hover, .btn-bevel:hover { background: #f2f2f2; }
button[type=submit]:active, .btn-bevel:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.authform label { display: block; margin-bottom: 0.8rem; font-size: 0.85rem; }
.authform input { margin-top: 0.25rem; }
.error {
  background: #fff;
  color: var(--pen-red);
  border: 2px solid var(--pen-red);
  border-radius: 0;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}
.stream h2 { margin-bottom: 0.6rem; }
.empty { color: var(--muted); font-style: italic; }

/* ---------- posts as squared PictoChat panels ---------- */
.post {
  position: relative;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 1.75rem 1.15rem 0.9rem;
  margin-bottom: 0.9rem;
}
.post header {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.post .author {
  position: absolute;
  top: -2px;
  left: -2px;
  border: 2px solid var(--pen, var(--ink));
  border-radius: 0;
  background: #fff;
  color: var(--pen, var(--ink));
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  text-decoration: none;
}
/* Hand-drawn profile icon inside the corner nameplate. */
.picon {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  border: 2px solid var(--ink);
  border-radius: 0;
  vertical-align: -5px;
  margin-right: 0.45rem;
  background: #fff;
}
.post time { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.post p { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.switch { font-size: 0.85rem; color: var(--muted); }
.post-actions { margin-top: 0.5rem; font-size: 0.82rem; }
.post-actions a { color: var(--muted); margin-right: 1rem; text-decoration: none; }
.post-actions a:hover { color: var(--ink); text-decoration: underline; }
/* Hearts: squared PictoChat-style like button. */
.like-btn {
  font: inherit;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0 0.45rem;
  margin-right: 1rem;
  cursor: pointer;
  line-height: 1.5;
}
.like-btn:hover { color: var(--ink); }
.like-btn.liked { color: var(--pen-red); border-color: var(--pen-red); }
.like-btn:disabled { opacity: 0.6; cursor: default; }
.replies {
  margin: 0.9rem 0 0.2rem 0.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--muted);
}
.replying-to {
  background: var(--paper);
  border: 1px dashed var(--muted);
  border-radius: 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  margin-top: 0;
}
.replying-to a { margin-left: 0.4rem; }
.post.deleted { opacity: 0.55; }
.post-actions .inline { margin-left: 0.8rem; }
.post-actions .danger { color: var(--pen-red); }
.foot {
  text-align: center;
  font-size: 0.78rem;
  padding: 1rem 1rem 1.5rem;
  border-top: 1px solid var(--ink);
  background: var(--term);
  color: #8a8a8a;
}
.foot .prompt { color: var(--pen-green); }
.foot a { color: #bdbdbd; }

/* ---------- drawing pad & attached drawings ---------- */
.draw-toggle { margin-top: 0.6rem; }
.draw-toggle button {
  font-family: var(--mono);
  background: #e8e8e8;
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
}
.draw-toggle button:active { transform: translate(2px, 2px); box-shadow: none; }
.draw-wrap { margin-top: 0.7rem; }
#draw-canvas {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  aspect-ratio: 3 / 2;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.draw-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.swatches { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 0;
  padding: 0;
  border: 2px solid var(--ink);
  cursor: pointer;
}
.swatch.active { outline: 2px solid var(--ink); outline-offset: 2px; }
#draw-color {
  width: 34px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  cursor: pointer;
}
.draw-tools .size, .draw-tools .toolbtn {
  font-family: var(--mono);
  border: 1px solid var(--ink);
  background: #e8e8e8;
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink);
}
.draw-tools .size:active, .draw-tools .toolbtn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.draw-tools .size.active, .draw-tools .toolbtn.active {
  background: var(--ink);
  color: var(--paper);
}
.post-drawing {
  display: block;
  max-width: 100%;
  border-radius: 0;
  border: 2px solid var(--ink);
  background: #fff;
  margin: 0.5rem 0 0.2rem;
}
.remix-note { font-size: 0.78rem; color: var(--muted); font-style: italic; }
.draw-tools .toolbtn:disabled { opacity: 0.4; cursor: default; }

/* ---------- daily drawing prompt ---------- */
.daily-prompt {
  background: var(--paper);
  border: 2px dashed var(--pen-purple);
  border-radius: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  margin: 0 0 0.8rem;
}
.daily-prompt button {
  font-family: var(--mono);
  background: #e8e8e8;
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink);
}
.daily-prompt button:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- drawing gallery ---------- */
.gallery-page h2 { margin-bottom: 0.8rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
}
.gallery-item {
  display: block;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.gallery-item:hover { border-color: var(--pen-blue); }
.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #fff;
  border-bottom: 2px solid var(--ink);
}
.gallery-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
}
.gallery-meta .penname { font-weight: 700; color: var(--pen, var(--ink)); }

/* ---------- direct messages ---------- */
.dm-page h2 { margin-bottom: 0.8rem; }
.dm-new { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; }
.dm-new input { flex: 1; }
.dm-new button { white-space: nowrap; }
.convo-list { display: flex; flex-direction: column; gap: 0.6rem; }
.convo {
  display: block;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: inherit;
}
.convo:hover { border-color: var(--pen-blue); }
.convo-who { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.convo-who .penname { color: var(--pen, var(--ink)); }
.convo-preview {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo time { font-size: 0.72rem; color: var(--muted); }
.dm-thread { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.2rem; }
.dm { max-width: 78%; padding: 0.55rem 0.85rem; }
.dm p { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.dm time { font-size: 0.68rem; opacity: 0.65; }
.dm.mine {
  align-self: flex-end;
  background: var(--term);
  color: var(--term-ink);
  border: 2px solid var(--term);
  border-radius: 0;
}
.dm.theirs {
  align-self: flex-start;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
}
.dm-compose textarea { margin-bottom: 0; }

@media (max-width: 560px) {
  .topbar .term-row { padding: 0.6rem 0.8rem 0.3rem; }
  .topbar .term-status { padding: 0.25rem 0.8rem 0.6rem; }
  .topbar nav a { margin-left: 0.9rem; }
  .composer, .authform { padding: 1rem; }
}

/* ---------- profiles ---------- */
.profile-card {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}
.profile-icon {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  flex: none;
}
.profile-icon.blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--muted);
  background: var(--paper);
}
.profile-meta h2 { margin: 0 0 0.3rem; }
.profile-meta p { margin: 0.15rem 0; }
.muted { color: var(--muted); font-size: 0.85rem; }
.notice {
  background: #fff;
  color: var(--pen-green);
  border: 2px solid var(--pen-green);
  border-radius: 0;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}
.profile-edit h3 { margin: 1.4rem 0 0.4rem; }
.profile-edit .swatches { margin-bottom: 0.4rem; }
#icon-canvas {
  width: 192px;
  height: 192px;
  image-rendering: pixelated;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  display: block;
  margin: 0.6rem 0;
}
.profile-edit .draw-tools { margin: 0.6rem 0 1rem; }
.btnrow { display: flex; gap: 0.6rem; }
