:root {
  --bg: #000000;
  --orange: #ff9c00;
  --peach: #ffcc99;
  --purple: #cc99cc;
  --blue: #9999ff;
  --red: #cc6666;
  --lcars-radius: 45px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--peach);
  font-family: 'Antonio', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.05em;
  overflow: hidden;
}

body {
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}

.lcars-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: 16px;
  gap: 8px;
  overflow: hidden;
}

.lcars-frame::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 220px;
  left: -220px;
  background: linear-gradient(90deg, transparent, rgba(153, 153, 255, 0.06), transparent);
  pointer-events: none;
  z-index: 2;
  animation: sweep 14s ease-in-out infinite;
}

@keyframes sweep {
  0% { left: -220px; }
  12% { left: 100%; }
  100% { left: 100%; }
}

.bar {
  background: var(--orange);
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-radius: 0 14px 14px 0;
  box-shadow: 0 0 16px rgba(255, 156, 0, 0.35);
}

.bar-bottom { border-radius: 14px 0 0 14px; }

.bar-label {
  color: #000;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}

.bar-code {
  color: #000;
  font-weight: 700;
  font-size: 13px;
  opacity: 0.7;
}

.elbow {
  width: 140px;
  height: 60px;
  background: var(--orange);
  box-shadow: 0 0 20px rgba(255, 156, 0, 0.35);
}

.elbow-tl { border-radius: var(--lcars-radius) 0 0 0; margin-bottom: -8px; }
.elbow-br { border-radius: 0 0 var(--lcars-radius) 0; margin-top: -8px; align-self: flex-end; }

.lcars-header, .lcars-footer {
  display: flex;
  flex-direction: column;
}

.lcars-body {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
}

.sidebar {
  width: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.side-block {
  border-radius: 0 24px 24px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 14px;
  gap: 2px;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.side-block:hover {
  filter: brightness(1.25);
  transform: translateX(2px);
}

.side-block.pulse {
  animation: panel-pulse 0.6s ease;
}

@keyframes panel-pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.4); }
  100% { filter: brightness(1); }
}

.sidebar-right .side-block {
  border-radius: 24px 0 0 24px;
  align-items: flex-start;
}

.side-code {
  color: #000;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}

.side-label {
  color: #000;
  font-weight: 700;
  font-size: 11px;
  opacity: 0.75;
}

.block-orange { background: var(--orange); }
.block-peach { background: var(--peach); }
.block-purple { background: var(--purple); }
.block-blue { background: var(--blue); }
.block-red { background: var(--red); }

.content {
  flex: 1;
  padding: 20px 32px;
  overflow-y: auto;
  min-width: 0;
}

.title {
  font-size: 44px;
  color: var(--blue);
  margin: 0 0 8px 0;
  text-transform: uppercase;
  font-weight: 800;
  text-shadow: 0 0 24px rgba(153, 153, 255, 0.55);
}

.subtitle {
  color: var(--peach);
  font-size: 15px;
  margin: 0 0 24px 0;
  text-transform: uppercase;
}

.subtitle::after {
  content: '_';
  animation: blink 1.1s step-end infinite;
}

.status-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.status-chip {
  padding: 8px 20px;
  border-radius: 16px;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.status-chip:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #000;
  animation: blink 1.6s ease-in-out infinite;
}

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

.chip-orange { background: var(--orange); }
.chip-blue { background: var(--blue); }
.chip-purple { background: var(--purple); }

.segment-bar {
  display: flex;
  gap: 4px;
  height: 14px;
  margin-bottom: 24px;
}

.segment {
  flex: 1;
  border-radius: 4px;
}

.seg-1, .seg-5 { background: var(--orange); }
.seg-2, .seg-6 { background: var(--peach); }
.seg-3, .seg-7 { background: var(--purple); }
.seg-4, .seg-8 { background: var(--blue); }

.segment {
  animation: seg-breathe 3.2s ease-in-out infinite;
}
.segment:nth-child(2) { animation-delay: 0.2s; }
.segment:nth-child(3) { animation-delay: 0.4s; }
.segment:nth-child(4) { animation-delay: 0.6s; }
.segment:nth-child(5) { animation-delay: 0.8s; }
.segment:nth-child(6) { animation-delay: 1.0s; }
.segment:nth-child(7) { animation-delay: 1.2s; }
.segment:nth-child(8) { animation-delay: 1.4s; }

@keyframes seg-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.readout-panel {
  background: #0c0c0c;
  border: 1px solid #332200;
  border-left: 4px solid var(--orange);
  border-radius: 4px 10px 10px 4px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.readout-panel:hover {
  border-color: var(--orange);
  box-shadow: 0 0 14px rgba(255, 156, 0, 0.25);
  transform: translateY(-2px);
}

.readout-panel.pulse {
  box-shadow: 0 0 16px rgba(153, 153, 255, 0.4);
  border-color: var(--blue);
}

.readout-label {
  font-size: 11px;
  color: #997755;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.readout-value {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.readout-value.ok { color: var(--blue); }

.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid #221a0a;
  border-bottom: 1px solid #221a0a;
  padding: 8px 0;
}

.ticker-text {
  display: inline-block;
  color: #664422;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: scroll-left 28s linear infinite;
  padding-left: 100%;
}

@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* Pi symbol trigger */
.pi-symbol {
  position: fixed;
  bottom: 5px;
  right: 22px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  color: #382c18;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #382c18;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 100;
}

.pi-symbol:hover {
  opacity: 0.9;
  color: var(--orange);
  border-color: var(--orange);
}

/* Editor overlay */
.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.editor-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.editor-overlay.hidden .editor-window {
  transform: scale(0.96);
}

.editor-window {
  width: min(1100px, 100%);
  height: min(780px, 100%);
  background: #0a0a0a;
  border: 2px solid var(--blue);
  border-radius: 24px 24px 10px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 40px rgba(153, 153, 255, 0.15);
  transform: scale(1);
  transition: transform 0.2s ease;
}

.editor-topbar {
  background: var(--blue);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  flex-shrink: 0;
}

.editor-title {
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.editor-close {
  background: #000;
  color: var(--blue);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.editor-body {
  flex: 1;
  display: flex;
  gap: 10px;
  min-height: 0;
  padding: 10px;
}

.editor-sidebar {
  width: 46px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.mini-block {
  flex: 1;
  border-radius: 0 12px 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 800;
  font-size: 12px;
}

.mini-orange { background: var(--orange); }
.mini-peach { background: var(--peach); }
.mini-purple { background: var(--purple); }
.mini-blue { background: var(--blue); }
.mini-red { background: var(--red); }

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 10px;
}

.output-field {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  color: var(--peach);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  letter-spacing: normal;
  background: #050505;
  border-radius: 12px;
  border: 1px solid #1a1a1a;
}

.output-field p { margin: 0 0 10px 0; }
.output-field ul, .output-field ol { margin: 0 0 10px 0; padding-left: 24px; }
.output-field h1, .output-field h2, .output-field h3 {
  color: var(--blue);
  text-transform: uppercase;
  margin: 16px 0 8px 0;
}
.output-field a { color: var(--orange); }
.output-field code:not(.hljs) {
  background: #1a1a1a;
  color: var(--orange);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
.output-field blockquote {
  border-left: 3px solid var(--purple);
  margin: 0 0 10px 0;
  padding: 4px 0 4px 14px;
  color: #cbb;
}

.output-hint {
  color: #555;
  margin: 0;
}

.output-entry {
  margin: 0 0 20px 0;
  animation: entry-in 0.25s ease;
}
.output-entry:last-child { margin-bottom: 0; }

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

.pending-dots span {
  animation: dot-pulse 1.4s infinite;
  opacity: 0.2;
}
.pending-dots span:nth-child(2) { animation-delay: 0.2s; }
.pending-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
.output-entry .who {
  color: var(--orange);
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.output-entry.user .who { color: var(--blue); }
.output-entry.error .who { color: var(--red); }
.output-entry.user .entry-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.output-entry.error .entry-body { color: var(--red); }

/* Code blocks */
.code-block {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  background: #111318;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1c1f26;
  padding: 6px 12px;
  border-bottom: 1px solid #2a2a2a;
}

.code-lang {
  font-size: 11px;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.copy-btn {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.code-path {
  font-size: 11px;
  color: #aaa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-actions, .project-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.copy-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}

.code-block code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #d8dee9;
  white-space: pre;
}

/* Minimal LCARS-toned syntax highlighting */
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section { color: var(--orange); }
.hljs-string, .hljs-attr, .hljs-symbol, .hljs-bullet, .hljs-addition { color: #99cc99; }
.hljs-comment, .hljs-quote, .hljs-deletion { color: #6a6a6a; font-style: italic; }
.hljs-number, .hljs-regexp, .hljs-meta { color: var(--purple); }
.hljs-title, .hljs-name, .hljs-built_in, .hljs-type { color: var(--blue); }
.hljs-variable, .hljs-template-variable, .hljs-attribute { color: var(--peach); }
.hljs-tag { color: #888; }

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: #0c0c0c;
  border: 1px solid #1a1a1a;
  border-radius: 12px;
  padding: 10px;
  flex-shrink: 0;
}

.input-field {
  flex: 1;
  background: #000;
  border: 1px solid var(--purple);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--peach);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: normal;
  outline: none;
  resize: vertical;
  min-height: 44px;
  max-height: 220px;
}

.input-field:focus {
  border-color: var(--blue);
}

.input-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.send-btn, .clear-btn, .upload-btn {
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-transform: uppercase;
}

.send-btn {
  background: var(--orange);
  color: #000;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.send-btn:hover { filter: brightness(1.1); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.clear-btn, .upload-btn {
  background: transparent;
  border: 1px solid #444;
  color: #999;
}

.clear-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.upload-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.entry-tools:not(:empty) {
  margin-bottom: 8px;
}

.tool-line {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  color: #778;
  overflow-wrap: anywhere;
}

.tool-line.failed {
  color: var(--red);
}

.changed-files {
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid #1c2a40;
  border-radius: 8px;
  background: #0d1420;
  font-size: 12px;
}

.changed-title {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.changed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  overflow-wrap: anywhere;
}

.changed-row .deleted {
  color: #887;
  text-decoration: line-through;
}

.project-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 20px;
  background: #0d1420;
  border-top: 1px solid #1c2a40;
  color: var(--blue);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.project-bar.hidden {
  display: none;
}

.system-notice {
  padding: 6px 20px;
  background: #1a1108;
  border-top: 1px solid #332200;
  color: var(--orange);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.system-notice.hidden {
  display: none;
}

.editor-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px;
  background: #111;
  border-top: 1px solid #222;
  color: #665;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* Scrollbars */
.output-field::-webkit-scrollbar, .content::-webkit-scrollbar {
  width: 8px;
}
.output-field::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb {
  background: #332200;
  border-radius: 4px;
}
.output-field::-webkit-scrollbar-track, .content::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 900px) {
  .sidebar-right { display: none; }
  .readout-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sidebar-left { width: 50px; }
  .side-label { display: none; }
  .title { font-size: 26px; }
  .content { padding: 16px; }
  .editor-sidebar { display: none; }
  .editor-window { border-radius: 12px; }
}
