/* zinkos space - shared ui */

/*
 * Dark is the default. Light is opt-in via data-theme on <html>, set before
 * first paint by js/theme.js so the page never flashes the wrong colours.
 */
:root {
  --bg: #000000;
  --yellow: #ffec00;
  --pill: #1a1a1a;
  --pill-hover: #262626;
  --pill-edge: #2e2e2e;
  --grey: #8a8a8a;
  --grey-pill: #141414;
  --line: #333333;

  --sunk: #0c0c0c;      /* inset panels: chat log, toolbars */
  --placeholder: #5a5a5a;
  --msg-name: #8ad6ff;
  --msg-body: #ded9c4;
  --msg-time: #4f4f4f;
  --danger: #ff5555;
  --scroll: #2a2a2a;
}

:root[data-theme="light"] {
  --bg: #f2eee2;
  --yellow: #7a5c00;    /* the accent has to carry text, so it darkens */
  --pill: #e4ddc9;
  --pill-hover: #d8cfb6;
  --pill-edge: #c4b995;
  --grey: #6f6858;
  --grey-pill: #e9e3d2;
  --line: #cdc3a6;

  --sunk: #ece5d3;
  --placeholder: #9a917c;
  --msg-name: #1f6f9c;
  --msg-body: #33302a;
  --msg-time: #918872;
  --danger: #b3261e;
  --scroll: #c4b995;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--yellow);
}

body {
  transition: background-color 0.15s ease, color 0.15s ease;
  font-family: "Courier New", ui-monospace, "DejaVu Sans Mono", monospace;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* --- header banner (gif + logo on top) --- */
.header {
  position: relative;
  line-height: 0; /* kill the inline-image gap under the banner */
}

.logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* the banner is a fixed 8:1 gif, so its height is width/8. sizing the logo
     as a share of that same width keeps it inside the banner at every size -
     a px floor here overflowed it on phones. */
  width: min(19%, 300px);
  height: auto;
  pointer-events: none;
  /* the haze behind it is bright in places - this keeps the white readable */
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, 0.95));
}

/*
 * A background rather than an <img> so the theme can swap it in css. Browsers
 * only fetch the rule that actually applies, so a visitor downloads the one
 * banner they can see, not both. aspect-ratio stands in for the intrinsic
 * size an <img> would have given us.
 */
.banner {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 150;
  background: url("assets/header.gif") no-repeat center / 100% 100%;
  image-rendering: pixelated;
  user-select: none;
}

:root[data-theme="light"] .banner {
  background-image: url("assets/header-day.gif");
}

/* --- layout --- */
.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}

.welcome {
  margin: 34px auto 0;
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section {
  margin-top: 46px;
}

.label {
  display: inline-block;
  background: var(--grey-pill);
  color: var(--grey);
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 8px;
  letter-spacing: 3px;
  font-size: 13px;
}

.row {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* --- pill buttons --- */
.btn {
  display: inline-block;
  background: var(--pill);
  color: var(--yellow);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 11px 20px;
  border: 1px solid var(--pill-edge);
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  transition: background 0.12s ease, transform 0.12s ease;
}

.btn:hover {
  background: var(--pill-hover);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn.small {
  font-size: 13px;
  padding: 8px 14px;
  letter-spacing: 1px;
}

/* --- the round badge at the foot of the home page --- */
.badge {
  display: block;
  width: min(150px, 42vw);
  height: auto;
  margin: 34px auto 0;
}

/* --- text blocks --- */
.note {
  margin-top: 26px;
  line-height: 1.75;
  font-size: 14px;
}

.dim { color: var(--grey); }

/* --- under construction sign (activities page, empty state) --- */
.sign {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sign .note { margin-top: 0; }

/* the yellow/black hazard stripes above and below the message */
.bar {
  width: min(320px, 90%);
  height: 10px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    -45deg,
    var(--yellow) 0 10px,
    #000 10px 20px
  );
  opacity: 0.85;
}

.dots::after {
  content: "";
  animation: dots 1.6s steps(1, end) infinite;
}

@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}

.caret {
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 5px;
  vertical-align: -2px;
  background: var(--yellow);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* --- heart cursor trail --- */
.trail {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none; /* must never eat a click */
  z-index: 40;          /* under the frame view (z 50) so it can't cover it */
}

.trail svg {
  position: absolute;
  will-change: transform, opacity;
  animation: heart-drift var(--life) linear forwards;
}

/*
 * Only the first and last keyframes touch transform, so the climb is a single
 * uninterrupted interpolation across the whole duration. The middle stops set
 * opacity alone - css animates each property independently, so fading in does
 * not hold the heart in place the way an earlier transform keyframe did.
 */
@keyframes heart-drift {
  0% {
    transform: translate(-50%, -50%) scale(0.85) rotate(var(--rot));
    opacity: 0;
  }
  10% { opacity: 1; }
  70% { opacity: 1; }
  100% {
    /* minus, so they climb the page and fade out as they near the top */
    transform:
      translate(calc(-50% + var(--drift)), calc(-50% - var(--rise)))
      scale(0.8)
      rotate(calc(var(--rot) * 1.6));
    opacity: 0;
  }
}

/* --- inputs --- */
.field {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.input {
  flex: 1 1 320px;
  min-width: 0;
  background: var(--pill);
  border: 1px solid var(--pill-edge);
  border-radius: 9px;
  color: var(--yellow);
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  padding: 11px 14px;
  outline: none;
  text-align: center;
}

.input::placeholder { color: var(--placeholder); letter-spacing: 1px; }
.input:focus { border-color: var(--yellow); }

/* --- settings page --- */
.btn.on {
  background: var(--yellow);
  color: var(--bg);
  border-color: var(--yellow);
}

.sub { margin-top: 30px; }
.small-label { font-size: 11px; letter-spacing: 2px; }
.stack.tight { gap: 8px; margin-top: 0; align-items: flex-start; }
.link { color: var(--yellow); }

.avatar-row {
  margin-top: 22px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--sunk);
  border: 1px solid var(--pill-edge);
}

.avatar.big { width: 72px; height: 72px; }

.avatar.blank {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  font-size: 26px;
}

.avatar.tiny {
  width: 20px;
  height: 20px;
  vertical-align: -5px;
  margin-right: 6px;
  font-size: 11px;
}

.save-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  background: var(--pill);
  border: 1px solid var(--pill-edge);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
}

.save-row .dim { font-size: 11px; }

/* --- accounts + lounge --- */
.stack {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.stack .input { width: min(320px, 100%); flex: none; text-align: center; }

.log {
  margin-top: 22px;
  height: min(48vh, 380px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--sunk);
  border: 1px solid var(--pill-edge);
  border-radius: 9px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.msg {
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere; /* one long unbroken word must not widen the box */
}

.msg-name { color: var(--msg-name); margin-right: 7px; }
.msg-name::after { content: ":"; }
.msg.mine .msg-name { color: var(--yellow); }
.msg-body { color: var(--msg-body); }
.msg-time { color: var(--msg-time); font-size: 11px; margin-left: 8px; }

.msg.notice {
  color: var(--grey);
  font-style: normal;
  text-align: center;
  font-size: 13px;
}

.mod {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #ff6b6b;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 1px;
  padding: 2px 5px;
  margin-left: 6px;
  border-radius: 4px;
  cursor: pointer;
  /*
   * Visible whenever they exist. These are only drawn for the owner, so there
   * was nothing to hide them from - and gating them behind :hover meant they
   * could not be reached at all on a phone, where there is no hover.
   */
  opacity: 0.6;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.msg:hover .mod, .mod:focus-visible { opacity: 1; }
.mod:hover { background: #2a1414; border-color: #ff6b6b; }

.who { font-size: 12px; letter-spacing: 1px; align-self: center; }

.log::-webkit-scrollbar { width: 10px; }
.log::-webkit-scrollbar-track { background: var(--sunk); }
.log::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 5px; }

/* --- activity grid --- */
.grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.card {
  background: var(--pill);
  border: 1px solid var(--pill-edge);
  border-radius: 9px;
  padding: 12px;
  text-decoration: none;
  color: var(--yellow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: background 0.12s ease, transform 0.12s ease;
}

.card:hover { background: var(--pill-hover); transform: translateY(-2px); }

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  image-rendering: pixelated;
  background: #000;
}

.card span {
  font-size: 13px;
  letter-spacing: 1px;
  word-break: break-word;
}

/* --- viewport --- */
.stage {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 50;
  flex-direction: column;
}

.stage.on { display: flex; }

.stage-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--sunk);
  border-bottom: 1px solid var(--line);
}

/* the address bar inside the frame, so you can jump straight to another
   site without exiting back to the page underneath */
.stage-search {
  display: flex;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
}

.input.flat {
  flex: 1 1 auto;
  text-align: left;
  font-size: 13px;
  padding: 8px 12px;
  letter-spacing: 1px;
}

@media (max-width: 620px) {
  .stage-bar { flex-wrap: wrap; }
  .stage-search { order: -1; flex-basis: 100%; }
}

.stage iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.status {
  margin-top: 18px;
  min-height: 20px;
  font-size: 13px;
  color: var(--grey);
  letter-spacing: 1px;
}

.status.err { color: var(--danger); }
