@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg-base: #0a0a0a;
  --primary: #33ff00;
  --secondary: #ffb000;
  --muted: #1f521f;
  --error: #ff3333;
  --border: #1f521f;
  --text-glow: 0 0 5px rgba(51, 255, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", "Fira Code", "VT323", monospace;
  background: var(--bg-base);
  color: var(--primary);
  text-shadow: var(--text-glow);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--primary);
  color: #000000;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.6;
  z-index: 0;
}

.app-header {
  position: relative;
  z-index: 1;
  padding: 24px 6vw 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.logo {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: lowercase;
}

.status {
  padding: 6px 14px;
  border: 1px solid var(--border);
  text-transform: uppercase;
}

.typing-demo {
  position: relative;
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  animation: typing 2.2s steps(var(--chars)) forwards;
}

.typing-demo::after {
  content: "█";
  margin-left: 6px;
  animation: blink 1s steps(1) infinite;
}

.app-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
  gap: 24px;
  padding: 20px 6vw 40px;
}

.panel {
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 70vh;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.control-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.field--span {
  grid-column: 1 / -1;
}

.prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.prompt {
  color: var(--muted);
  font-size: 0.75rem;
}

.field input,
.field textarea {
  background: transparent;
  border: none;
  color: var(--primary);
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 8px;
  border: 1px dashed var(--border);
}

.message {
  border: 1px solid var(--border);
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
}

.message .meta {
  font-size: 0.7rem;
  color: var(--secondary);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-transform: uppercase;
}

.message .body {
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.message--signal {
  border-color: var(--secondary);
}

.message--assistant {
  border-color: var(--primary);
}

.message--thought {
  border-color: var(--muted);
}

.message--progress {
  border-color: var(--muted);
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.composer-actions {
  display: flex;
  gap: 12px;
}

button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

button:hover {
  background: var(--primary);
  color: #000000;
}

button.ghost {
  color: var(--secondary);
  border-color: var(--muted);
}

button.ghost:hover {
  background: var(--secondary);
  color: #000000;
}

.workspace-controls {
  display: grid;
  gap: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.workspace-body {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.section {
  border: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.section h3 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--primary);
}

.content-item {
  padding: 6px 8px;
  border: 1px dashed var(--border);
}

.code-block {
  background: #050505;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 12px;
  font-size: 0.78rem;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
}

.is-hidden {
  display: none;
}

.cursor {
  display: inline-block;
  width: 0.8ch;
  height: 1em;
  background: var(--primary);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: calc(var(--chars) * 1ch);
  }
}

@media (max-width: 960px) {
  .app-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .inline-input {
    grid-template-columns: 1fr;
  }

  .status {
    justify-self: start;
  }
}
