/* ══════════════════════════════════════════════════════════════
   absorber — black-hole themed portal UI
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #08080a;
  --accent: 160, 255, 227;          /* mint-green, used as rgb() */
  --text: #e0e0e0;
  --muted: rgba(160, 255, 227, 0.35);
  --border: rgba(160, 255, 227, 0.1);
  --panel: rgba(8, 8, 10, 0.92);
  --font: 'Geist Mono', 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  cursor: default;
}

/* ── Canvas ─────────────────────────────────────────────────── */
canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

/* ── Status bar ─────────────────────────────────────────────── */
.status-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  pointer-events: none;
}

.status-bar > * { pointer-events: all; }

.status-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

.auth-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-status {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

/* ── Pill button (unified style) ────────────────────────────── */
.pill-btn {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(160, 255, 227, 0.6);
  background: rgba(160, 255, 227, 0.04);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.pill-btn:hover {
  color: rgba(160, 255, 227, 0.9);
  border-color: rgba(160, 255, 227, 0.25);
  background: rgba(160, 255, 227, 0.08);
}

.pill-btn--accent {
  color: rgba(160, 255, 227, 0.85);
  border-color: rgba(160, 255, 227, 0.25);
  background: rgba(160, 255, 227, 0.08);
}

.pill-btn--accent:hover {
  background: rgba(160, 255, 227, 0.14);
  border-color: rgba(160, 255, 227, 0.4);
}

/* ── Drop overlay / event horizon ───────────────────────────── */
.drop-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.event-horizon {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.event-horizon:hover {
  transform: scale(1.05);
}

.event-horizon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent), 0.07);
  animation: ring-pulse 5s ease-in-out infinite;
}

.event-horizon-ring:nth-child(2) {
  inset: -12px;
  border-color: rgba(var(--accent), 0.04);
  animation-delay: -1.6s;
  animation-duration: 6s;
}

.event-horizon-ring:nth-child(3) {
  inset: -28px;
  border-color: rgba(var(--accent), 0.02);
  animation-delay: -3.2s;
  animation-duration: 7s;
}

@keyframes ring-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}

.event-horizon-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  user-select: none;
}

.event-horizon-inner .icon {
  font-size: 28px;
  color: rgba(var(--accent), 0.5);
  margin-bottom: 8px;
  transition: color 0.3s, transform 0.3s;
}

.event-horizon:hover .icon {
  color: rgba(var(--accent), 0.9);
  transform: translateY(-2px);
}

.event-horizon-inner .label {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s;
}

.event-horizon:hover .label {
  color: rgba(var(--accent), 0.7);
}

.file-input { display: none; }

/* ── Auth gate (covers event horizon when not signed in) ───── */
.auth-gate {
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  backdrop-filter: blur(2px);
}

.auth-gate.hidden { display: none; }

.auth-gate-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-gate-inner span {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Drag active states ─────────────────────────────────────── */
body.drag-active .event-horizon-ring {
  border-color: rgba(var(--accent), 0.15);
  animation-duration: 2s;
}

body.drag-active .icon {
  color: rgba(var(--accent), 0.9) !important;
  animation: breathe 1s ease-in-out infinite;
}

body.drag-active .label {
  color: rgba(var(--accent), 0.8) !important;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── File list (bottom) ─────────────────────────────────────── */
.file-list {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-height: 200px;
  overflow-y: auto;
}

.file-item {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(var(--accent), 0.6);
  background: rgba(var(--accent), 0.04);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 20px;
  animation: file-appear 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  white-space: nowrap;
}

@keyframes file-appear {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Queue tray ─────────────────────────────────────────────── */
.queue-tray {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(500px, 90vw);
  max-height: 220px;
  overflow-y: auto;
}

.queue-tray:empty { display: none; }

#queueList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#queueList:empty { display: none; }

.queue-item {
  background: rgba(var(--accent), 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  animation: file-appear 0.4s ease forwards;
  opacity: 0;
}

.qi-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.qi-name {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(var(--accent), 0.7);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qi-status {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.qi-progress {
  width: 100%;
  background: rgba(var(--accent), 0.06);
  border-radius: 999px;
  height: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.qi-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(var(--accent), 0.5);
  transition: width 0.3s ease;
  border-radius: 999px;
}

/* ── Modal (parser review) ──────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal-card {
  width: min(600px, 90vw);
  max-height: 80vh;
  overflow: auto;
  background: rgba(8, 8, 10, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.modal-card h3 {
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(var(--accent), 0.7);
  font-weight: 600;
}

.modal-subtitle {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-questions {
  display: grid;
  gap: 10px;
}

.modal-questions label {
  display: grid;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-questions input,
.modal-questions textarea {
  width: 100%;
  background: rgba(var(--accent), 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 12px;
}

.modal-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.modal-details summary {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-details pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-size: 11px;
  color: rgba(var(--accent), 0.5);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Chat panel ─────────────────────────────────────────────── */
.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  z-index: 200;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.chat-panel.hidden { display: none; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(var(--accent), 0.1);
  border: 1px solid rgba(var(--accent), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  color: rgba(var(--accent), 0.7);
  flex-shrink: 0;
}

.chat-title strong {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(var(--accent), 0.7);
  font-weight: 600;
}

.chat-file-label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-close {
  font-size: 16px;
  padding: 2px 6px;
  line-height: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 260px;
  max-height: 340px;
}

.chat-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  max-width: 88%;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg-assistant {
  background: rgba(var(--accent), 0.05);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: rgba(var(--accent), 0.7);
}

.chat-msg-user {
  background: rgba(var(--accent), 0.08);
  border: 1px solid rgba(var(--accent), 0.15);
  align-self: flex-end;
  color: var(--text);
}

.chat-typing {
  opacity: 0.4;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.chat-input-row input {
  flex: 1;
  background: rgba(var(--accent), 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 11px;
  font-family: var(--font);
  outline: none;
}

.chat-input-row input:focus {
  border-color: rgba(var(--accent), 0.3);
}

/* ── Artifact cards ─────────────────────────────────────────── */
.chat-artifacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.chat-artifact-card {
  background: rgba(var(--accent), 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-artifact-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(var(--accent), 0.7);
}

.chat-artifact-type {
  font-size: 9px;
  background: rgba(var(--accent), 0.08);
  color: rgba(var(--accent), 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-artifact-summary {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.chat-artifact-toggle {
  font-family: var(--font);
  font-size: 10px;
  color: rgba(var(--accent), 0.5);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 4px;
  letter-spacing: 0.1em;
}

.chat-artifact-toggle:hover {
  color: rgba(var(--accent), 0.8);
}

.chat-artifact-content {
  font-size: 10px;
  color: rgba(var(--accent), 0.4);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  padding: 8px;
  margin-top: 4px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-artifact-content.hidden { display: none; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--accent), 0.12); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent), 0.25); }
