:root {
  --bg: #0b0c10;
  --fg: #e5e5e5;
  --muted: #9aa0a6;
  --accent: #8ab4f8;
  --line: #1f2229;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 720px; margin: 0 auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
header { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; gap: 8px; }
.brand { color: var(--accent); font-weight: 700; }
.id { color: var(--muted); font-size: 12px; }
.btn { background: transparent; color: var(--fg); border: 1px solid var(--line); padding: 6px 10px; border-radius: 6px; cursor: pointer; min-height: 36px; touch-action: manipulation; }
.btn:hover { border-color: var(--accent); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: 8px; border-bottom: 1px dashed var(--line); margin: 4px 0 8px; }
.tab { color: var(--fg); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; background: #0f1116; }
.tab:hover { border-color: var(--accent); }
.tab.active { color: var(--accent); border-color: var(--accent); }

/* Modal */
.hidden { display: none !important; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none !important; }
.modal-inner { background: #111318; border: 1px solid var(--line); border-radius: 8px; padding: 16px; width: min(420px, 90vw); }
.modal-title { font-weight: 700; margin-bottom: 8px; }
.modal-section { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.modal-section input { background: #0f1116; color: var(--fg); border: 1px solid var(--line); padding: 10px; border-radius: 6px; font-size: 16px; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-error { color: #ff6b6b; margin-left: auto; font-size: 12px; }
.composer { padding: 8px 0; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.composer input { width: 100%; background: transparent; color: var(--fg); border: none; outline: none; font-size: 16px; padding: 10px 2px; }
.feed { display: flex; flex-direction: column; gap: 4px; }
.line { white-space: pre-wrap; word-break: break-word; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ts { color: var(--muted); margin-right: 8px; }

/* Mobile layout tweaks */
@media (max-width: 640px) {
  header { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
  .id { font-size: 12px; }
  .btn { min-height: 40px; padding: 10px 12px; font-size: 16px; }
  .line { padding: 8px 0; }
  .tabs { flex-wrap: wrap; }
}

@media (max-width: 360px) {
  #app { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
  .actions { gap: 6px; }
}

/* Error banner */
.error-banner {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: #2b1515;
  color: #ffd7d7;
  border: 1px solid #6b1b1b;
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 90vw;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  z-index: 2000;
}
.error-banner.hidden { display: none !important; }
.error-close {
  margin-left: auto;
  background: transparent;
  color: #ffd7d7;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* Debug */
.debug-pre {
  background: #0f1116;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
