/* I.O. Terminal — ~0.5KB */

:root {
  --bg: #0a0a0a;
  --fg: #e0e0e0;
  --dim: #666;
  --accent: #7c9cff;
  --font: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#io-root {
  max-width: none;
  padding: 2rem 2rem 33vh 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#io-terminal {
  max-width: 800px;
}

#io-built {
  width: 100%;
}

/* Terminal lines */
.io-line {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 0;
  opacity: 0;
  animation: line-in 0.2s var(--ease) forwards;
}

.io-line.speaker-io { color: var(--fg); }
.io-line.speaker-user { color: var(--accent); }
.io-line.speaker-system { color: var(--dim); font-style: italic; }

/* Cursor blink on active typing line */
.io-line.typing::after {
  content: "▊";
  animation: blink 0.8s step-end infinite;
  color: var(--accent);
  margin-left: 1px;
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Inline input — flows with terminal output */
.io-input-line {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 1.2rem;
  padding: 2px 0;
  opacity: 0;
  animation: line-in 0.2s var(--ease) forwards;
}

.io-input-line .prompt {
  color: var(--dim);
  user-select: none;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.io-input-line .cursor {
  color: var(--accent);
  animation: blink 1.2s step-end infinite;
  font-size: 0.85em;
  margin-left: 1px;
  flex-shrink: 0;
}

.io-input-line input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 15px;
  caret-color: transparent;
  padding: 0;
}

.io-input-line input::selection {
  background: rgba(124, 156, 255, 0.3);
}

/* User lines get a bit of top margin too */
.io-line.speaker-user {
  margin-top: 1.2rem;
}

/* Activity log — subtle, dim, smaller */
.io-line.speaker-activity {
  color: var(--dim);
  font-size: 0.8em;
  opacity: 0.5;
  margin-top: 0.3rem;
}

.hidden { display: none !important; }

/* Status indicator */
#io-status {
  position: fixed;
  bottom: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background-color 0.3s;
}

#io-status.connected    { background: #22c55e; }
#io-status.connecting   { background: #eab308; animation: pulse 1.2s infinite; }
#io-status.reconnecting { background: #eab308; animation: pulse 1.2s infinite; }
#io-status.disconnected { background: #ef4444; }
#io-status.offline      { background: #ef4444; opacity: 0.5; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.2; }
}

/* Morph targets — elements being morphed get this during transition */
.morph-source {
  view-transition-name: morph-target;
}

/* Built components area — below chat */
#io-built {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .io-line { animation: none; opacity: 1; }
  .io-line.typing::after { animation: none; opacity: 1; }
  #io-status { animation: none; }
}

/* Mobile */
@media (max-width: 600px) {
  #io-root { padding: 1rem; }
  html, body { font-size: 14px; }
}
