/* ============================================
   DEV BY ELIZAOS
   8-bit / black & white / tiled pixel grid
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --black: #000;
  --white: #fff;
  --gray-1: #111;
  --gray-2: #222;
  --gray-3: #444;
  --gray-4: #666;
  --gray-5: #999;
  --gray-6: #bbb;
  --gray-7: #ddd;
  --gray-8: #eee;

  --red: #ff0000;
  --green: #00ff00;
  --orange: #ff8800;

  --text-primary: #fff;
  --text-secondary: #bbb;
  --text-muted: #666;

  --font: 'VT323', 'Courier New', monospace;
  --font-pixel: 'Press Start 2P', monospace;

  --tile: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--black);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100vh;
  /* 8-bit tile grid */
  background-image:
    linear-gradient(var(--gray-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-2) 1px, transparent 1px);
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
}

a { color: var(--white); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--tile);
}

/* ===== HEADER / NAV ===== */
.site-header {
  background: var(--white);
  border-bottom: 4px solid var(--black);
  padding: 0 var(--tile);
  position: sticky;
  top: 0;
  z-index: 100;
  image-rendering: pixelated;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
}
.nav-logo {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--black);
  letter-spacing: 2px;
  text-transform: lowercase;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo-img {
  height: 38px;
  image-rendering: pixelated;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--tile);
}
.contract-address {
  font-family: var(--font);
  font-size: 13px;
  color: var(--gray-4);
  cursor: pointer;
  padding: 2px 8px;
  border: 1px solid var(--gray-6);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contract-address:hover {
  color: var(--black);
  border-color: var(--black);
}

/* ===== STREAM BADGES ===== */
.stream-badge {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 4px 8px;
  border: 2px solid var(--black);
  letter-spacing: 1px;
}
.stream-badge-live {
  background: var(--black);
  color: var(--white);
  animation: pixel-blink 1s steps(2) infinite;
}
.stream-badge-offline {
  background: var(--white);
  color: var(--gray-4);
  border-color: var(--gray-4);
}
@keyframes pixel-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== CARDS ===== */
.card {
  background: var(--gray-1);
  border: 3px solid var(--white);
  padding: var(--tile);
  margin-bottom: var(--tile);
  box-shadow: 4px 4px 0 var(--gray-3);
}

/* ===== STREAM SECTION ===== */
.stream-section {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 0;
  border: 3px solid var(--white);
  background: var(--black);
  height: calc(100vh - 66px);
  box-shadow: 6px 6px 0 var(--gray-3);
}

/* ===== CHAT PANEL ===== */
.chat-side-panel {
  display: flex;
  flex-direction: column;
  border-right: 3px solid var(--white);
  background: var(--black);
  overflow: hidden;
}
.chat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 2px solid var(--white);
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--white);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--white);
  color: var(--black);
}
.chat-card-title { }
.chat-card-count { color: var(--gray-4); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--black);
}
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-track { background: var(--black); border-left: 2px solid var(--gray-3); }
.chat-messages::-webkit-scrollbar-thumb { background: var(--white); }
.chat-msg {
  padding: 3px 0;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}
.chat-msg:hover .chat-mod-controls { display: inline; }
.chat-mod-controls { display: none; margin-left: 6px; }
.mod-btn {
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-5);
  margin-left: 4px;
  font-family: var(--font);
}
.mod-btn:hover { color: var(--white); }
.chat-msg-user {
  color: var(--white);
  font-weight: bold;
  font-size: 15px;
}
.chat-msg-text {
  color: var(--gray-6);
  font-size: 16px;
}
.chat-system-msg {
  color: var(--gray-4);
  font-size: 14px;
  padding: 4px 0;
}
.chat-pinned-msg {
  background: var(--gray-1);
  border-bottom: 2px solid var(--white);
  padding: 6px 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pinned-label {
  color: var(--white);
  font-size: 12px;
  font-weight: bold;
}
.chat-input-bar-stacked {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-top: 2px solid var(--white);
  background: var(--black);
}

/* ===== FORM INPUTS ===== */
.form-input {
  background: var(--black);
  border: 2px solid var(--gray-3);
  color: var(--white);
  font-family: var(--font);
  font-size: 16px;
  padding: 4px 6px;
  width: 100%;
  outline: none;
}
.form-input:focus {
  border-color: var(--white);
}
.form-input::placeholder {
  color: var(--gray-4);
}

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 8px 12px;
  border: 2px solid var(--white);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  letter-spacing: 1px;
  image-rendering: pixelated;
}
.btn-primary {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}
.btn-primary:hover {
  background: var(--gray-7);
  text-decoration: none;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 8px;
}

/* ===== STREAM PLAYER ===== */
.stream-player-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  overflow: hidden;
}
.stream-player {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  /* scanline effect */
  background-image: repeating-linear-gradient(
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(255, 255, 255, 0.02) 4px
  );
}
.stream-offline-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-5);
  font-family: var(--font-pixel);
  text-align: center;
  padding: 40px;
}
.offline-icon {
  font-size: 32px;
  margin-bottom: var(--tile);
  color: var(--gray-4);
}
.offline-title {
  font-size: 10px;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-transform: uppercase;
  color: var(--white);
}
.offline-sub {
  font-family: var(--font);
  font-size: 16px;
  color: var(--gray-5);
}
.stream-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
}
.stream-live-tag {
  font-family: var(--font-pixel);
  font-size: 8px;
  background: var(--white);
  color: var(--black);
  padding: 4px 10px;
  letter-spacing: 2px;
  border: 2px solid var(--black);
  animation: pixel-blink 1s steps(2) infinite;
}
.stream-emotion-tag {
  font-family: var(--font);
  font-size: 16px;
  background: var(--black);
  color: var(--white);
  padding: 4px 10px;
  border: 2px solid var(--white);
}

/* ===== VIDEO HUD OVERLAY ===== */
.video-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 3;
  font-family: var(--font);
}
.hud-top-right {
  position: absolute;
  top: 36px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.hud-expression, .hud-eye-contact {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 3px 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.hud-label {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--gray-5);
  letter-spacing: 1px;
}
.hud-value {
  font-size: 15px;
  color: var(--white);
}
.hud-bottom {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
}
.hud-transcript {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.hud-transcript-text {
  font-size: 18px;
  color: var(--white);
  line-height: 1.4;
  word-break: break-word;
}

.hud-left {
  position: absolute;
  top: 36px;
  left: 8px;
  max-width: 240px;
}
.hud-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hud-log-entry {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  font-size: 13px;
  color: var(--gray-6);
  animation: hudFade 4s forwards;
}
@keyframes hudFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== DEV ACTIVITY PANEL (right side) ===== */
.analysis-panel {
  display: flex;
  flex-direction: column;
  border-left: 3px solid var(--white);
  background: var(--black);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--black);
}
.analysis-panel::-webkit-scrollbar { width: 8px; }
.analysis-panel::-webkit-scrollbar-track { background: var(--black); }
.analysis-panel::-webkit-scrollbar-thumb { background: var(--white); }

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 2px solid var(--white);
  background: var(--white);
  color: var(--black);
}
.ai-tag {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--black);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.analysis-status {
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-3);
}

/* Section Labels */
.section-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

/* Speech Section */
.speech-section {
  padding: 10px;
  border-bottom: 2px solid var(--gray-2);
}
.speech-transcript {
  max-height: 80px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--gray-6);
  background: var(--gray-1);
  border: 2px solid var(--gray-3);
  padding: 6px;
  margin-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--black);
}
.speech-placeholder {
  color: var(--gray-4);
  font-size: 14px;
}
.speech-line {
  padding: 2px 0;
  border-bottom: 1px solid var(--gray-2);
}

/* Analysis Log */
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 2px solid var(--gray-2);
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.analysis-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--black);
}
.analysis-log::-webkit-scrollbar { width: 8px; }
.analysis-log::-webkit-scrollbar-track { background: var(--black); }
.analysis-log::-webkit-scrollbar-thumb { background: var(--white); }

.analysis-log-entry {
  display: flex;
  gap: 6px;
  padding: 3px 0;
  line-height: 1.4;
  border-bottom: 1px solid var(--gray-2);
}
.analysis-log-new {
  animation: logSlide 0.2s steps(3);
}
@keyframes logSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.log-time {
  color: var(--gray-4);
  font-size: 13px;
  white-space: nowrap;
  min-width: 55px;
}
.log-icon {
  color: var(--white);
  font-size: 13px;
  min-width: 40px;
}
.log-message {
  color: var(--gray-6);
  font-size: 14px;
}


/* ===== ACTIVITY STATS (in right panel) ===== */
.activity-status-badge {
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 2px 6px;
  border: 2px solid var(--black);
  background: var(--black);
  color: var(--gray-4);
}
.activity-status-badge.active {
  background: var(--black);
  color: var(--white);
  animation: pixel-blink 1.5s steps(2) infinite;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 2px solid var(--gray-2);
}
.activity-stat {
  padding: 10px 12px;
  border-right: 1px solid var(--gray-2);
  text-align: center;
}
.activity-stat:last-child { border-right: none; }
.activity-stat-label {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--gray-5);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.activity-stat-value {
  font-family: var(--font);
  font-size: 20px;
  color: var(--white);
}
.activity-window {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-2);
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.activity-window-label {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--gray-5);
  letter-spacing: 1px;
  white-space: nowrap;
}
.activity-window-title {
  color: var(--gray-6);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-log {
  padding: 6px 12px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--black);
}
.activity-log-entry {
  padding: 2px 0;
  border-bottom: 1px solid var(--gray-2);
  display: flex;
  gap: 8px;
  font-size: 13px;
}
.activity-log-time {
  color: var(--gray-4);
  min-width: 50px;
  font-size: 12px;
}
.activity-log-text {
  color: var(--gray-6);
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: var(--tile);
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--gray-4);
  letter-spacing: 1px;
  border-top: 3px solid var(--white);
  margin-top: 24px;
}

/* ===== STATUS MESSAGES ===== */
.status-msg {
  padding: 8px 12px;
  font-size: 14px;
  border: 2px solid var(--white);
  margin-bottom: 10px;
}
.status-msg.success { border-color: var(--white); color: var(--white); }
.status-msg.error { border-color: var(--white); color: var(--white); background: var(--gray-1); }
.status-msg.info { border-color: var(--gray-5); color: var(--gray-6); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .stream-section {
    grid-template-columns: 1fr;
  }
  .chat-side-panel {
    border-right: none;
    border-bottom: 3px solid var(--white);
    max-height: 250px;
    order: 2;
  }
  .stream-player-wrap {
    order: 1;
  }
  .analysis-panel {
    border-left: none;
    border-top: 3px solid var(--white);
    max-height: 400px;
    order: 3;
  }
  .stream-player { min-height: 260px; }
}

@media (max-width: 600px) {
  .nav-logo { font-size: 9px; }
  body { font-size: 16px; }
}
