* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: #1e293b;
  position: sticky;
  top: 0;
  z-index: 10;
}

.status { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; display: inline-block; }
.dot.connected { background: #22c55e; }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: #e2e8f0; padding: 4px 8px; border-radius: 8px;
}
.icon-btn:active { background: #334155; }
.icon-btn.active { background: #2563eb; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

.composer {
  background: #1e293b;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 20px;
}

#title-input, #text-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 15px;
}
#text-input { min-height: 90px; resize: vertical; font-family: inherit; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

button, .file-btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #334155;
  color: #e2e8f0;
  font-size: 14px;
  cursor: pointer;
}
button.primary { background: #2563eb; border-color: #2563eb; }
.file-btn { position: relative; display: inline-flex; align-items: center; }

.file-preview {
  margin-top: 10px;
  padding: 8px;
  background: #0f172a;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.file-preview img { max-height: 60px; border-radius: 6px; }
.hidden { display: none !important; }

.messages { display: flex; flex-direction: column; gap: 10px; }

.msg-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 12px;
}
.msg-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}
.msg-title { font-weight: 600; margin-bottom: 4px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-card img { max-width: 100%; border-radius: 8px; display: block; margin-top: 6px; cursor: zoom-in; }
.msg-card a.file-link {
  display: inline-block; margin-top: 6px; color: #60a5fa; text-decoration: none;
}
.msg-actions { display: flex; gap: 8px; margin-top: 8px; }
.msg-action {
  padding: 6px 10px; font-size: 12px; border-radius: 6px;
  border: 1px solid #334155; background: #0f172a; color: #cbd5e1; cursor: pointer;
}
.msg-action:active { background: #334155; }
.msg-empty { text-align: center; color: #64748b; padding: 40px 0; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.overlay .card {
  background: #1e293b; padding: 24px; border-radius: 12px; width: 90%; max-width: 360px;
}
.overlay label { display: block; margin: 10px 0 4px; font-size: 13px; color: #94a3b8; }
.overlay input {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #334155;
  background: #0f172a; color: #e2e8f0;
}
.overlay button {
  margin-top: 16px; width: 100%; background: #2563eb; border-color: #2563eb;
}

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  padding: 16px;
}
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px;
}
