/* ── Reset & Variables ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #090c10;
  --bg2:         #0d1117;
  --bg3:         #12181f;
  --border:      #1e2d3d;
  --border2:     #243447;
  --accent:      #00e5ff;
  --accent2:     #00ff9d;
  --accent3:     #ff3c6e;
  --text:        #cdd9e5;
  --text-dim:    #586374;
  --text-bright: #e6edf3;
  --sys:         #586374;
  --own-bg:      rgba(0, 229, 255, 0.06);
  --msg-radius:  8px;
  --font-mono:   'Share Tech Mono', monospace;
  --font-ui:     'Syne', sans-serif;
  --sidebar-w:   260px;
  --header-h:    54px;
  --input-h:     80px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Boot Screen ────────────────────────────────── */
#boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity .6s ease;
}
#boot-screen.fade-out { opacity: 0; pointer-events: none; }

.boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 480px;
  width: 90%;
}

.boot-ascii {
  font-family: var(--font-mono);
  font-size: clamp(6px, 1.4vw, 12px);
  color: var(--accent);
  line-height: 1.2;
  text-align: center;
  filter: drop-shadow(0 0 12px var(--accent));
  white-space: pre;
}

.boot-subtitle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 6px;
}

.blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.boot-log {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: 4px;
}
.boot-log .log-line { opacity: 0; animation: fadeIn .3s ease forwards; }
@keyframes fadeIn { to { opacity: 1; } }
.boot-log .log-ok   { color: var(--accent2); }
.boot-log .log-info { color: var(--accent); }
.boot-log .log-warn { color: #f0a500; }

.boot-enter {
  margin-top: 8px;
}
#btn-enter {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 10px 32px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .2s;
  filter: drop-shadow(0 0 10px var(--accent));
}
#btn-enter:hover {
  background: var(--accent2);
  filter: drop-shadow(0 0 16px var(--accent2));
}




/* substituição do .boot-enter e botões separados por: */
.boot-enter {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#btn-enter, #btn-help {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 10px 32px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .2s;
  filter: drop-shadow(0 0 10px var(--accent));
}
#btn-enter:hover, #btn-help:hover {
  background: var(--accent2);
  filter: drop-shadow(0 0 16px var(--accent2));
}

/* ── Help Modal ─────────────────────────────────── */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 12, 16, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
  animation: overlayIn .25s ease;
}
.help-overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.help-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.08), 0 24px 48px rgba(0,0,0,.6);
  animation: boxIn .25s ease;
  overflow: hidden;
}

@keyframes boxIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.help-title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-title-icon {
  color: var(--accent);
  font-size: 16px;
  filter: drop-shadow(0 0 6px var(--accent));
}

.help-header button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-header button:hover {
  border-color: var(--accent3);
  color: var(--accent3);
}

.help-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent));
}

.help-section p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}
.help-list li {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  padding-left: 14px;
  position: relative;
}
.help-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent2);
  font-size: 14px;
  line-height: 1.5;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-bright);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}
.key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-bright);
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-bottom-width: 2px;
  padding: 1px 6px;
  border-radius: 3px;
}
.hl-accent  { color: var(--accent);  font-weight: 600; }
.hl-accent2 { color: var(--accent2); font-weight: 600; }

.help-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}
.help-footer .mono {
  font-size: 10px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  letter-spacing: .5px;
}

/* ── App Layout ─────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#app.hidden { display: none; }

/* ── Sidebar ────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .3s ease, min-width .3s ease;
  overflow: hidden;
}
#sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  font-size: 20px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent));
}
.brand-name {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--text-bright);
}

.sidebar-section {
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* Identity card */
.identity-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.id-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  background: rgba(0,229,255,0.07);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px var(--accent));
}
.id-alias {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-bright);
}
.id-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent2);
  letter-spacing: 2px;
  margin-top: 2px;
}

/* Room input */
.room-input-wrap {
  display: flex;
  gap: 6px;
}
.room-input-wrap input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color .2s;
}
.room-input-wrap input:focus { border-color: var(--accent); }
.room-input-wrap button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  width: 32px;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s;
}
.room-input-wrap button:hover { background: var(--accent2); }

/* Rooms list */
.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.rooms-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
}
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.room-item:hover { background: var(--bg3); border-color: var(--border); }
.room-item.active { background: rgba(0,229,255,.08); border-color: var(--accent); }
.room-item-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-bright);
}
.room-item-name::before { content: '#'; color: var(--accent); margin-right: 4px; }
.room-item-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 10px;
}
.btn-refresh {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  transition: color .2s;
}
.btn-refresh:hover { color: var(--accent); }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background .3s;
}
.status-dot.online { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); }
.status-dot.offline { background: var(--accent3); }
.users-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Chat Panel ─────────────────────────────────── */
#chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.chat-room-tag {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-bright);
}
.hash { color: var(--accent); margin-right: 2px; }

.chat-header-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}
.chat-header-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
}
.messages-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 0;
  min-height: 100%;
  /* justify-content: flex-end; */
}

.messages-inner > *:first-child {
  margin-top: auto;
}

.welcome-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  text-align: center;
  opacity: .5;
}
.welcome-icon { font-size: 40px; color: var(--accent); }
.welcome-text { font-size: 15px; color: var(--text); font-weight: 600; }
.welcome-sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* Message bubble */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: var(--msg-radius);
  animation: msgIn .25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg:hover { background: rgba(255,255,255,0.02); }
.msg.own-msg { background: var(--own-bg); }

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.msg-alias {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  color: var(--accent);
}
.msg.own-msg .msg-alias { color: var(--accent2); }
.msg-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}
.msg-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}

/* System message */
.msg-system {
  text-align: center;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sys);
  animation: msgIn .25s ease;
}

/* Day separator */
.day-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
}
.day-sep::before, .day-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Typing bar */
.typing-bar {
  min-height: 20px;
  padding: 2px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Input area */
.input-area {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px 0 14px;
  transition: border-color .2s;
}
.input-wrap:focus-within { border-color: var(--accent); }

#msg-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 0;
}
#msg-input::placeholder { color: var(--text-dim); }
#msg-input:disabled { opacity: .4; cursor: not-allowed; }

.char-counter {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.char-counter.warn { color: #f0a500; }
.char-counter.danger { color: var(--accent3); }

#btn-send {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
#btn-send:hover { background: var(--accent2); }
#btn-send:disabled { opacity: .3; cursor: not-allowed; background: var(--text-dim); }

.input-hint {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: .5px;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 600px) {
  :root { --sidebar-w: 220px; }
  #sidebar { position: absolute; z-index: 10; height: 100%; }
  #sidebar.collapsed { transform: translateX(-100%); }
  .help-box { max-height: 94vh; }
}

/* ── Scan-line overlay ───────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.08) 2px,
    rgba(0,0,0,.08) 4px
  );
  pointer-events: none;
  z-index: 1000;
}
