:root {
  --bg:        #0a0f0a;
  --surface:   #0d140d;
  --border:    #1a2e1a;
  --green:     #00ff41;
  --green-dim: #1a6b2a;
  --green-mid: #2ea043;
  --amber:     #ffaa00;
  --red:       #ff4444;
  --blue:      #4fc3f7;
  --muted:     #3a6b3a;
  --text:      #b8f5b8;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  overflow: hidden;
}

/* ── Header (matches hub/drone/idle-industry style) ── */
header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: #1a1a24;
  border-bottom: 1px solid #2a2a3e;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  flex-shrink: 0; user-select: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e8e8f0;
}
.hdr-back { color: #888899; text-decoration: none; font-size: .8rem; font-weight: 600; transition: color .15s; white-space: nowrap; }
.hdr-back:hover { color: #e8e8f0; }
header h1 { font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
header h1 span { color: #6c63ff; }
.hdr-level {
  font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  color: #888899; background: #22223a; border: 1px solid #2a2a3e;
  border-radius: 6px; padding: 3px 10px; white-space: nowrap;
}
.hdr-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.hdr-user  { font-size: .85rem; color: #857df8; font-weight: 600; white-space: nowrap; }

.hud-meter { display: flex; align-items: center; gap: 6px; font-size: 11px; font-family: 'Segoe UI', system-ui, sans-serif; }
.hud-meter-label { color: #888899; text-transform: uppercase; letter-spacing: 1px; }
.hud-meter-pct   { color: #e8e8f0; min-width: 28px; font-size: 11px; }
.meter-bar  { width: 72px; height: 5px; background: #22223a; border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.meter-fill.trace      { background: #ffaa00; }
.meter-fill.trace.high { background: #ff4444; }
.meter-fill.notoriety  { background: #e05070; }

@media (max-width: 640px) {
  header { flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  header h1 { font-size: 1rem; flex: 1; }
  .hdr-level { display: none; }
  .hdr-right {
    width: 100%; margin-left: 0;
    justify-content: space-between; gap: 8px;
  }
  .hud-meter { flex: 1; justify-content: center; }
  .meter-bar { flex: 1; max-width: 80px; }
  .hdr-user { font-size: .8rem; }
}

/* ── Layout ── */
#layout { display: flex; height: calc(100vh - 45px); }
@media (max-width: 640px) { #layout { height: calc(100vh - 76px); } }

/* ── Terminal ── */
#terminal {
  flex: 1; display: flex; flex-direction: column;
  padding: 12px 16px; overflow: hidden; cursor: text; position: relative;
}
#terminal::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px);
  pointer-events: none;
}
#output {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  white-space: pre-wrap; word-break: break-word;
  line-height: 1.15; padding-bottom: 8px;
}
#output::-webkit-scrollbar { width: 4px; }
#output::-webkit-scrollbar-thumb { background: var(--green-dim); border-radius: 2px; }

.out-line { display: block; }
.out-cmd  { color: var(--green); }
.out-info { color: var(--text); }
.out-ok   { color: #44ff88; }
.out-warn { color: var(--amber); }
.out-err  { color: var(--red); }
.out-dim  { color: var(--muted); }
.out-sys  { color: var(--blue); }

#input-row {
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#prompt    { color: var(--green); white-space: nowrap; flex-shrink: 0; }
#cmd-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--green); font-family: inherit; font-size: inherit;
  caret-color: var(--green);
}
#cmd-input:disabled { opacity: .5; }

/* ── Sidebar ── */
#sidebar {
  width: 210px; border-left: 1px solid var(--border);
  background: var(--surface); padding: 12px;
  overflow-y: auto; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 14px;
  font-size: 12px; user-select: none;
}
.sb-section { display: flex; flex-direction: column; gap: 5px; }
.sb-title {
  color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
  font-size: 10px; border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.sb-item      { color: var(--text); line-height: 1.5; }
.sb-item.dim  { color: var(--muted); font-size: 11px; }
.tool-chip {
  display: inline-block;
  background: rgba(0,255,65,0.07); border: 1px solid var(--green-dim);
  border-radius: 3px; padding: 2px 6px; color: var(--green);
  margin: 2px 2px 2px 0; font-size: 11px;
}

/* ── Mission complete ── */
#mission-complete {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
#mission-complete[hidden] { display: none; }
.mc-box {
  background: var(--surface); border: 1px solid var(--green);
  border-radius: 4px; padding: 32px 40px; text-align: center;
  max-width: 400px; box-shadow: 0 0 40px rgba(0,255,65,0.12);
}
.mc-title  { font-size: 1.3rem; color: var(--green); margin-bottom: 8px; letter-spacing: 2px; }
.mc-sub    { color: var(--text); margin-bottom: 8px; font-size: 13px; }
.mc-reward { color: var(--amber); margin-bottom: 24px; font-size: 13px; }
.mc-btn {
  background: rgba(0,255,65,0.08); border: 1px solid var(--green);
  color: var(--green); padding: 8px 24px;
  font-family: inherit; font-size: 13px; cursor: pointer;
  border-radius: 3px; transition: background .15s; letter-spacing: 1px;
}
.mc-btn:hover { background: rgba(0,255,65,0.18); }

/* ── Intro overlay ── */
#intro-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; flex-direction: column; gap: 24px;
}
#intro-overlay[hidden] { display: none; }
.intro-title {
  font-size: 2.2rem; color: var(--green);
  letter-spacing: 8px; font-weight: bold;
  text-shadow: 0 0 20px rgba(0,255,65,0.4);
}
.intro-text {
  max-width: 480px; text-align: center;
  line-height: 2; color: var(--text); font-size: 13px;
  white-space: pre-line;
}
.intro-btn {
  background: none; border: 1px solid var(--green); color: var(--green);
  padding: 10px 36px; font-family: inherit; font-size: 13px;
  cursor: pointer; letter-spacing: 3px;
  transition: background .15s, box-shadow .15s;
}
.intro-btn:hover {
  background: rgba(0,255,65,0.1);
  box-shadow: 0 0 20px rgba(0,255,65,0.2);
}

/* ── Progress bar animation ── */
@keyframes scan-pulse { 0%,100% { opacity:1; } 50% { opacity:.5; } }
.scanning { animation: scan-pulse .8s infinite; }

@media (max-width: 600px) {
  #sidebar { display: none; }
  body { font-size: 13px; }
}
