/* -- RESET -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Courier New', 'Consolas', 'Liberation Mono', monospace;
  background: #0a0a0a;
  color: #c0c0c0;
  min-height: 100vh;
}

/* -- LANDING -- */
body.landing {
  display: flex; align-items: center; justify-content: center;
  overflow-x: hidden;
  padding-top: 16px;
}
.landing-centre { text-align: center; padding: 0 1rem; }
.landing-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  border: 2px solid #d00; margin-bottom: 1rem;
  object-fit: cover;
}
.landing-centre h1 {
  font-size: 2rem; letter-spacing: .3em; color: #eee;
  text-shadow: 0 0 12px rgba(221,0,0,.6);
}
.tagline { color: #888; margin: .5rem 0 2rem; letter-spacing: .15em; font-size: .85rem; }
.landing-nav { margin: 2rem 0; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.landing-footer { margin-top: 3rem; }
.blink { animation: blink 1.2s step-end infinite; color: #d00; font-size: .8rem; }
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .2 } }

.terminal-prompt {
  display: inline-flex; align-items: center; gap: .4rem; margin-top: 1.5rem;
  padding: .65rem 1.2rem;
  background: #0d0d0d; border: 1px solid #222; border-left: 3px solid #d00;
  font-size: .85rem; color: #aaa; text-align: left;
  max-width: 100%;
}
@media (max-width: 600px) {
  .terminal-prompt { flex-wrap: wrap; padding: .5rem .8rem; }
  .prompt-flavour {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex-shrink: 1; min-width: 0;
  }
  .prompt-input { width: 12ch; }
}
.terminal-prompt .cursor {
  animation: blink 1s step-end infinite;
  color: #d00; font-weight: bold; user-select: none;
}
.prompt-sym { color: #d00; font-weight: bold; user-select: none; }
.prompt-flavour { color: #555; white-space: nowrap; }
.prompt-sep { color: #333; user-select: none; }
.prompt-input-wrap { display: inline-flex; align-items: center; gap: .2rem; }
.prompt-input {
  width: 18ch; background: transparent; border: none; outline: none; padding: 0;
  color: #c0c0c0; font-family: inherit; font-size: inherit;
  caret-color: #d00;
}
.prompt-input::placeholder { color: #444; }
.brain-icon { animation: pulse-green 3s ease-in-out infinite; }
@keyframes pulse-green {
  0%, 100% { color: #2a2; }
  50%      { color: #eee; }
}

/* -- BUTTONS -- */
.btn {
  display: inline-block; padding: .75rem 2rem;
  border: 1px solid #d00; color: #d00; text-decoration: none;
  letter-spacing: .2em; font-size: .85rem;
  transition: all .2s;
}
.btn:hover { background: #d00; color: #0a0a0a; box-shadow: 0 0 20px rgba(221,0,0,.4); }
.btn2 {
  display: inline-block; padding: .75rem 2rem;
  border: 1px solid #444; color: #444; text-decoration: none;
  letter-spacing: .2em; font-size: .85rem;
  transition: all .2s;
}
.btn2:hover { background: #444; color: #0a0a0a; box-shadow: 0 0 20px rgba(221,0,0,.4); }
.btn3 {
  display: inline-block; padding: .75rem 2rem;
  border: 1px solid #3388ee; color: #3388ee; text-decoration: none;
  letter-spacing: .2em; font-size: .85rem;
  transition: all .2s;
}
.btn3:hover { background: #3388ee; color: #0a0a0a; box-shadow: 0 0 20px rgba(51,136,238,.4); }
.btn4 {
  display: inline-block; padding: .75rem 2rem;
  border: 1px solid #eee; color: #eee; text-decoration: none;
  letter-spacing: .2em; font-size: .85rem;
  transition: all .2s;
}
.btn4:hover { background: #eee; color: #0a0a0a; box-shadow: 0 0 20px rgba(255,255,255,.4); }

/* -- TOPBAR -- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .35rem;
  padding: .6rem 1.5rem; border-bottom: 1px solid #222;
  background: #0d0d0d; position: sticky; top: 0; z-index: 10;
}
.topbar-left {
  display: flex; align-items: center; gap: 1rem;
}
.topbar-brand {
  display: flex; align-items: center; gap: .6rem;
  color: #eee; text-decoration: none; font-weight: bold; letter-spacing: .15em;
}
.topbar-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #d00; object-fit: cover; }
.topbar-right { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.topbar-right-top { display: flex; align-items: center; gap: 1rem; }
.proxy-network { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.proxy-label { font-size: .65rem; color: #555; letter-spacing: .1em; white-space: nowrap; }
.proxy-tag {
  display: inline-block; padding: .1rem .35rem; text-decoration: none;
  border: 1px solid #333; font-size: .65rem; color: #888;
  letter-spacing: .08em; transition: all .15s; line-height: 1.4;
}
.proxy-tag:hover { border-color: #666; color: #aaa; background: #151515; }
.topbar-status { font-size: .8rem; letter-spacing: .1em; color: #d00; }
.operator-label { font-size: .75rem; color: #666; letter-spacing: .05em; }
.sound-toggle {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; padding: 0; line-height: 1;
  color: #555; transition: color .15s;
}
.sound-toggle:hover { color: #eee; }
.sound-toggle.sound-on { color: #eee; }
.trace-status {
  font-size: .75rem; letter-spacing: .1em; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .35rem;
}
.trace-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.trace-dot--active {
  background: #0a8; box-shadow: 0 0 6px #0a8;
  animation: trace-pulse-green 1.5s ease-in-out infinite;
}
.trace-dot--lost {
  background: #d00; box-shadow: 0 0 6px #d00;
  animation: trace-pulse-red 1.5s ease-in-out infinite;
}
@keyframes trace-pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #0a8; }
  50%      { opacity: .4; box-shadow: 0 0 2px #0a8; }
}
@keyframes trace-pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #d00; }
  50%      { opacity: .4; box-shadow: 0 0 2px #d00; }
}
.trace-label { color: #888; }
.trace-time  { color: #666; font-variant-numeric: tabular-nums; }

/* -- TOPBAR MOBILE -- */
@media (max-width: 900px) {
  .topbar-left { flex-direction: column; align-items: flex-start; gap: .15rem; }
  .topbar-right { width: 100%; }
}

/* -- SYNC LINE -- */
.sync-line {
  text-align: center; font-size: .7rem; color: #555;
  letter-spacing: .12em; padding: .5rem 0;
}

/* -- LAYOUT -- */
.container {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem; padding: 1.5rem; max-width: 1600px; margin: 0 auto;
}
@media (max-width: 1200px) { .container { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px), (orientation: portrait) { .container { grid-template-columns: 1fr; } }

/* -- TABS (narrow or portrait: single-pane tab view) -- */
.tabs { display: none; }
@media (max-width: 900px), (orientation: portrait) {
  .tabs { display: flex; border-bottom: 1px solid #222; margin-bottom: 1rem; }
  .tab {
    flex: 1; background: #0d0d0d; border: none; border-bottom: 2px solid transparent;
    padding: .6rem 1rem; color: #666; font-family: inherit; font-size: .7rem;
    letter-spacing: .2em; cursor: pointer; text-transform: uppercase;
    transition: color .15s, border-color .15s;
  }
  .tab:hover { color: #aaa; }
  .tab.active { color: #d00; border-bottom-color: #d00; }
  .feed, .manifest, .external { display: none; }
  #feed.active, #manifest.active, #external.active { display: block; }
  .feed h2, .manifest h2, .external h2 { display: none; }
}

/* -- SECTIONS -- */
.feed, .manifest, .external { min-width: 0; }
h2 {
  font-size: .8rem; letter-spacing: .25em; color: #d00; margin-bottom: 1rem;
  border-bottom: 1px solid #222; padding-bottom: .5rem;
}

/* -- CARD (feed entry & manifest item) -- */
.card {
  display: flex; gap: .8rem; padding: .75rem;
  border-bottom: 1px solid #151515; transition: background .15s;
  align-items: flex-start;
}
.card:hover { background: #111; }
.card-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid #333; object-fit: cover;
}
.card-body { flex: 1; min-width: 0; }
.card-title {
  color: #eee; font-weight: bold; font-size: .9rem; text-decoration: none;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-title:hover { color: #d00; }
.card-title--no-link { color: #888; font-weight: normal; }
.card-meta {
  font-size: .7rem; color: #666; margin-top: .2rem;
  display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center;
}
.card-meta span { white-space: nowrap; }
.card-meta .tag {
  display: inline-block; padding: 0 .35rem;
  border: 1px solid #333; font-size: .65rem; color: #888;
  text-transform: uppercase; letter-spacing: .1em;
}
.card-meta .tag-added    { border-color: #0a8; color: #0a8; }
.card-meta .tag-removed  { border-color: #d00; color: #d00; }
.card-meta .tag-modified { border-color: #da0; color: #da0; }
.card-meta .tag-post     { border-color: #48f; color: #48f; }
.card-meta .tag-page     { border-color: #8af; color: #8af; }
.card-meta .tag-attachment { border-color: #a8a; color: #a8a; }
.card-meta .tag-site { border-color: #48f; color: #48f; text-transform: none; }
.card-meta-label { color: #555; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.ts-stack { display: inline-flex; flex-direction: column; line-height: 1.3; }
.ts-utc   { color: #555; font-size: .65rem; }
.ts-local { color: #999; font-size: .65rem; }
.card-diff {
  margin-top: .4rem; background: #0d0d0d;
  font-size: .7rem; overflow-x: auto;
  border-left: 2px solid #d00;
}
.diff-block {
  margin: 0; padding: .4rem .5rem; white-space: pre-wrap; color: #aaa;
  font-family: 'Courier New', 'Consolas', 'Liberation Mono', monospace;
  line-height: 1.5; tab-size: 4;
}
.diff-add { background: rgba(0,170,0,.18); color: #80ff80; display: inline-block; width: 100%; }
.diff-rem { background: rgba(220,30,30,.18); color: #ff8585; display: inline-block; width: 100%; }
.diff-hunk { color: #6688cc; }
.diff-ctx  { color: #888; }
.diff-more { color: #cc8800; }

/* -- SEARCH -- */
.search-input {
  background: #0d0d0d; border: 1px solid #222; color: #c0c0c0;
  padding: .4rem .6rem; font-family: inherit; font-size: .8rem; width: 100%;
}
.search-input:focus { outline: none; border-color: #d00; }
.manifest-controls { display: flex; gap: .5rem; margin-bottom: 1rem; }
.manifest-controls select { width: auto; }

/* -- DECORATIVE DATA GIF (desktop only, bottom-left) -- */
.data-gif {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  width: 48px;
  height: auto;
  border: 1px solid #d00;
  pointer-events: none;
  user-select: none;
}
@media (max-height: 700px) {
  .data-gif { display: none; }
}

/* -- FEED CONTROLS (sort toggle) -- */
.feed-controls {
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .75rem;
}
.sort-label {
  font-size: .6rem; color: #555; letter-spacing: .12em;
}
.sort-btn {
  background: transparent; border: 1px solid #333;
  color: #666; font-family: inherit; font-size: .6rem;
  letter-spacing: .1em; padding: .2rem .5rem; cursor: pointer;
  transition: all .15s;
}
.sort-btn:hover { border-color: #d00; color: #d00; }
.sort-btn.active { border-color: #d00; color: #d00; background: rgba(221,0,0,.08); }

/* -- GAME TIME DISPLAY -- */
.gt-stack {
  display: inline-flex; flex-direction: column;
  font-size: .6rem; line-height: 1.3; margin-left: .35rem;
  vertical-align: middle;
}
.gt-label {
  color: #888; font-size: .55rem; letter-spacing: .08em;
}
.gt-utc { color: #668; }
.gt-local { color: #556; }

/* -- SAFETY FEED FOLDOUT -- */
.safety-feed {
  position: relative;
  margin-top: .35rem;
  align-self: flex-end;
}
.safety-feed-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .5rem;
  border: 1px solid #d00;
  color: #fff;
  font-size: .65rem;
  letter-spacing: .12em;
  cursor: pointer;
  user-select: none;
  background: #0d0d0d;
  transition: background .15s;
}
.safety-feed-bar:hover {
  background: #1a0808;
}
.safety-feed-dot {
  font-size: .55rem;
  color: #d00;
  animation: blink 1s step-end infinite;
  margin-left: auto;
}
.safety-feed-arrow {
  font-size: .55rem;
  color: #d00;
  transition: transform .2s;
}
.safety-feed.open .safety-feed-arrow {
  transform: rotate(90deg);
}
.safety-feed-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  min-width: 260px;
  max-width: 360px;
  border: 1px solid #d00;
  background: #0d0d0d;
  padding: .5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.6);
}
.safety-feed.open .safety-feed-content {
  display: block;
}
.safety-feed-content img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* -- UTILITY -- */
.hidden { display: none !important; }
.status-online { color: #0a8 !important; }
.status-offline { color: #d00 !important; }
.empty-msg { color: #444; font-size: .8rem; text-align: center; padding: 2rem 0; }
